package com.xbts.system.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.Data;
import com.xbts.common.annotation.Excel;
import com.xbts.common.utils.StringUtils;
import com.xbts.common.core.domain.BaseEntity;

/**
 * 模板素材关联对象 sei_material_template
 *
 * @author xbts
 * @date 2023-09-08
 */
@Data
@ApiModel("模板素材关联对象")
@TableName("sei_material_template")
public class SeiMaterialTemplate extends BaseEntity {

private static final long serialVersionUID=1L;

    /** id */
    @TableId
    private String id;

    /** 模板ID */
    @Excel(name = "模板ID")
    @ApiModelProperty("模板ID")
    @NotEmpty(message = "模板ID不能为空")
    private String templateId;

    /** 二级素材ID */
    @Excel(name = "二级素材ID")
    @ApiModelProperty("二级素材ID")
    @NotEmpty(message = "二级素材ID不能为空")
    private String secondLevelMaterialId;

    /** 三级素材ID */
    @Excel(name = "三级素材ID")
    @ApiModelProperty("三级素材ID")
    @NotEmpty(message = "三级素材ID不能为空")
    private String threeLevelMaterialId;

    @ApiModelProperty("三级素材名称")
    @TableField(exist = false)
    private String threeLevelMaterialName;

    /** 素材内容 */
    @Excel(name = "素材内容")
    @ApiModelProperty("素材内容")
    private String content;

    @ApiModelProperty("关联类型（1模板，2标书任务）")
    private Integer type;


    public<T> QueryWrapper<T> queryWrapper(){
        QueryWrapper<T> queryWrapper=new QueryWrapper<>();
        queryWrapper.like(StringUtils.isNotEmpty(templateId),"template_id",templateId);
        queryWrapper.like(StringUtils.isNotEmpty(secondLevelMaterialId),"second_level_material_id",secondLevelMaterialId);
        queryWrapper.like(StringUtils.isNotEmpty(threeLevelMaterialId),"three_level_material_id",threeLevelMaterialId);
        return queryWrapper;
    }
}